package org.cbg.mouslisten;

import java.awt.event.MouseEvent;
import java.awt.event.MouseListener;
import java.math.BigDecimal;

import org.come.Frame.ZhuFrame;
import org.come.entity.Goodstable;
import org.come.socket.Agreement;
import org.come.socket.SendMessageUntil;
import org.come.until.GsonUtil;
import org.come.until.UserData;

import com.tool.tcpimg.InputBean;

public class CBGmoveMouslisten implements MouseListener{

    /**类型*/
    private Integer saletype;
    /**对应数据库表ID*/
    private BigDecimal otherid;
	public CBGmoveMouslisten(Integer saletype, BigDecimal otherid) {
		super();
		this.saletype = saletype;
		this.otherid = otherid;
	}
	public void qh(Integer saletype, BigDecimal otherid) {
		this.saletype = saletype;
		this.otherid = otherid;
	}
	@Override
	public void mouseClicked(MouseEvent e) {
		// TODO Auto-generated method stub
		
	}

	@Override
	public void mousePressed(MouseEvent e) {
		// TODO Auto-generated method stub
		
	}

	@Override
	public void mouseReleased(MouseEvent e) {
		// TODO Auto-generated method stub
		
	}

	@Override
	public void mouseEntered(MouseEvent e) {
		if (saletype==2) {
		    Goodstable goodstable = new Goodstable();
		    goodstable.setType(100L);
            goodstable.setSkin("8");
            goodstable.setGoodsname("大话币");
            goodstable.setInstruction(UserData.getMS(otherid));
			ZhuFrame.getZhuJpanel().creatgoodtext(goodstable);
		}else if (saletype==3|saletype==5) {
			InputBean inputBean=new InputBean();
			inputBean.setType(2);
			inputBean.setId(otherid);
			String sendmes = Agreement.getAgreement().richMAgreement(GsonUtil.getGsonUtil().getgson().toJson(inputBean));
			SendMessageUntil.toServer(sendmes);	
		}else if (saletype==4) {
			InputBean inputBean=new InputBean();
			inputBean.setType(3);
			inputBean.setId(otherid);
			String sendmes = Agreement.getAgreement().richMAgreement(GsonUtil.getGsonUtil().getgson().toJson(inputBean));
			SendMessageUntil.toServer(sendmes);	
		}else if (saletype==6) {
			InputBean inputBean=new InputBean();
			inputBean.setType(4);
			inputBean.setId(otherid);
			String sendmes = Agreement.getAgreement().richMAgreement(GsonUtil.getGsonUtil().getgson().toJson(inputBean));
			SendMessageUntil.toServer(sendmes);	
		}
	}

	@Override
	public void mouseExited(MouseEvent e) {
		// TODO Auto-generated method stub
		if (saletype==2||saletype==3|saletype==5) {
			ZhuFrame.getZhuJpanel().cleargoodtext();
		}else if (saletype==4) {
			ZhuFrame.getZhuJpanel().pettext();
		}else if (saletype==6) {
			ZhuFrame.getZhuJpanel().clearlingtext();
		}
	}

}
